]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Better handle setting the active session
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 16 Mar 2015 17:54:37 +0000 (10:54 -0700)
committerRay Strode <rstrode@redhat.com>
Mon, 16 Mar 2015 21:47:27 +0000 (17:47 -0400)
We currently use the setActiveSession method to both mark a menu item as
selected, and also tell gdm about the current session the user selected.

Since gdm is ultimately in charge of the state, we should decouple this
and simply ask gdm to set the session, and have the menu item reflect
what gdm thinks is the current session.

This prevents state getting mismatched and oscillations from happening,
where we get in a loop of constantly telling gdm what the session is.

https://bugzilla.gnome.org/show_bug.cgi?id=740142

js/gdm/loginDialog.js

index 6b90bb0b594202a1e56019b904a58c136471c343..c269cb30cf27d8d4b15c305a66a6e4ba658c873e 100644 (file)
@@ -323,13 +323,15 @@ const SessionMenuButton = new Lang.Class({
         }
     },
 
-    setActiveSession: function(sessionId) {
+    activeSessionChanged: function(sessionId) {
          if (sessionId == this._activeSessionId)
              return;
 
          this._activeSessionId = sessionId;
          this._updateOrnament();
+    },
 
+    setActiveSession: function(sessionId) {
          this.emit('session-activated', this._activeSessionId);
     },
 
@@ -788,7 +790,7 @@ const LoginDialog = new Lang.Class({
     },
 
     _onDefaultSessionChanged: function(client, sessionId) {
-        this._sessionMenuButton.setActiveSession(sessionId);
+        this._sessionMenuButton.activeSessionChanged(sessionId);
     },
 
     _shouldShowSessionMenuButton: function() {